package com.example.mydy.model;

import com.google.gson.annotations.SerializedName;

public class UserData {
    @SerializedName("id")
    private int id;
    
    @SerializedName("username")
    private String username;
    
    @SerializedName("nickname")
    private String nickname;
    
    @SerializedName("userNickname")
    private String userNickname;
    
    @SerializedName("points")
    private int points;
    
    @SerializedName("level")
    private String level;
    
    @SerializedName("phone")
    private String phone;
    
    @SerializedName("balance")
    private double balance;
    
    @SerializedName("taskRewardToday")
    private double taskRewardToday;
    
    @SerializedName("subTaskReward")
    private double subTaskReward;
    
    @SerializedName("inviteCount")
    private int inviteCount;
    
    @SerializedName("taskCount")
    private int taskCount;
    
    @SerializedName("userBalance")
    private double userBalance;
    
    @SerializedName("status")
    private String status;
    
    @SerializedName("created_at")
    private String createdAt;
    
    @SerializedName("updated_at")
    private String updatedAt;
    
    @SerializedName("inviter")
    private String inviter;
    
    @SerializedName("inviteCode")
    private String inviteCode;
    
    @SerializedName("avatarUrl")
    private String avatarUrl;
    
    @SerializedName("todayIncome")
    private double todayIncome;
    
    @SerializedName("totalIncome")
    private double totalIncome;
    
    @SerializedName("completedTaskCount")
    private int completedTaskCount;
    
    public UserData() {
    }
    
    // Getters and Setters
    public int getId() {
        return id;
    }
    
    public void setId(int id) {
        this.id = id;
    }
    
    public String getUsername() {
        return username;
    }
    
    public void setUsername(String username) {
        this.username = username;
    }
    
    public String getNickname() {
        return nickname;
    }
    
    public void setNickname(String nickname) {
        this.nickname = nickname;
    }
    
    public String getUserNickname() {
        return userNickname != null ? userNickname : nickname;
    }
    
    public void setUserNickname(String userNickname) {
        this.userNickname = userNickname;
    }
    
    public int getPoints() {
        return points;
    }
    
    public void setPoints(int points) {
        this.points = points;
    }
    
    public String getLevel() {
        return level;
    }
    
    public void setLevel(String level) {
        this.level = level;
    }
    
    public String getPhone() {
        return phone;
    }
    
    public void setPhone(String phone) {
        this.phone = phone;
    }
    
    public double getBalance() {
        return balance;
    }
    
    public void setBalance(double balance) {
        this.balance = balance;
    }
    
    public double getTaskRewardToday() {
        return taskRewardToday;
    }
    
    /**
     * 获取每日任务奖励，作为getTaskRewardToday的别名
     * @return 每日任务奖励
     */
    public double getDailyTaskReward() {
        return taskRewardToday;
    }
    
    public void setTaskRewardToday(double taskRewardToday) {
        this.taskRewardToday = taskRewardToday;
    }
    
    public double getSubTaskReward() {
        return subTaskReward;
    }
    
    /**
     * 获取每日子任务奖励，作为getSubTaskReward的别名
     * @return 每日子任务奖励
     */
    public double getDailySubTaskReward() {
        return subTaskReward;
    }
    
    public void setSubTaskReward(double subTaskReward) {
        this.subTaskReward = subTaskReward;
    }
    
    public int getInviteCount() {
        return inviteCount;
    }
    
    public void setInviteCount(int inviteCount) {
        this.inviteCount = inviteCount;
    }
    
    public int getTaskCount() {
        return taskCount;
    }
    
    public void setTaskCount(int taskCount) {
        this.taskCount = taskCount;
    }
    
    public double getUserBalance() {
        return userBalance;
    }
    
    public void setUserBalance(double userBalance) {
        this.userBalance = userBalance;
    }
    
    public String getStatus() {
        return status;
    }
    
    public void setStatus(String status) {
        this.status = status;
    }
    
    public String getCreatedAt() {
        return createdAt;
    }
    
    public void setCreatedAt(String createdAt) {
        this.createdAt = createdAt;
    }
    
    public String getUpdatedAt() {
        return updatedAt;
    }
    
    public void setUpdatedAt(String updatedAt) {
        this.updatedAt = updatedAt;
    }
    
    public String getInviter() {
        return inviter;
    }
    
    public void setInviter(String inviter) {
        this.inviter = inviter;
    }
    
    public String getInviteCode() {
        return inviteCode;
    }
    
    public void setInviteCode(String inviteCode) {
        this.inviteCode = inviteCode;
    }
    
    public String getAvatarUrl() {
        return avatarUrl;
    }
    
    public void setAvatarUrl(String avatarUrl) {
        this.avatarUrl = avatarUrl;
    }
    
    public void setTodayInvites(int invites) {
        this.inviteCount = invites;
    }
    
    public void setTodayTaskReward(double reward) {
        this.taskRewardToday = reward;
    }
    
    public void setTodaySubTaskReward(double reward) {
        this.subTaskReward = reward;
    }
    
    public double getTodayIncome() {
        return todayIncome > 0 ? todayIncome : taskRewardToday;
    }
    
    public void setTodayIncome(double todayIncome) {
        this.todayIncome = todayIncome;
    }
    
    public double getTotalIncome() {
        return totalIncome > 0 ? totalIncome : balance;
    }
    
    public void setTotalIncome(double totalIncome) {
        this.totalIncome = totalIncome;
    }
    
    public int getCompletedTaskCount() {
        return completedTaskCount > 0 ? completedTaskCount : taskCount;
    }
    
    public void setCompletedTaskCount(int completedTaskCount) {
        this.completedTaskCount = completedTaskCount;
    }
    
    public boolean isValid() {
        return id > 0 && username != null && !username.isEmpty();
    }
    
    @Override
    public String toString() {
        return "UserData{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", nickname='" + nickname + '\'' +
                ", level='" + level + '\'' +
                ", balance=" + balance +
                ", phone='" + phone + '\'' +
                ", points=" + points +
                ", inviter='" + inviter + '\'' +
                ", createdAt='" + createdAt + '\'' +
                '}';
    }
} 